<?php 
$num1=isset($_POST['num1'])?floatval(($_POST['num1'])):0;
$num2=isset($_POST['num2'])?floatval(($_POST['num2'])):0;
$fuhao=isset($_POST['fuhao'])?($_POST['fuhao']):'+';

switch ($fuhao) {
	case '+':
		$zuihou = $num1 + $num2;
		break;
	case '-':
		$zuihou = $num1 - $num2;
		break;
	case '*':
		$zuihou = $num1 * $num2;
		break;
	case '/':
		$zuihou = $num1 / $num2;
		break;
	default:
		$zuihou = 0;
		break;
}
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>Document</title>
</head>
<style type="text/css">
*{
	padding: 0;
	margin: 0;
}
a{
	text-decoration: none;
}
h1{
	position: absolute;
	top: 30px;
	left: 580px;
	font-size: 40px;
	background: #9DD2EA;
}
body{
	background: #E6E6E6;
}
form{
	width: 320px;
	height: 400px;
	padding-left: 20px;
	padding-top: 20px;
	margin: 100px auto;
	background:#9DD2EA;/*#9DD2EA*/
	position: relative;
	border-radius: 90px;
}
span{
	display: block;
	width: 60px;
	height: 60px;
	float: left;
	margin-left: 10px;
	font-size: 30px;
	font-weight: 700;
	margin-top: 15px;
	text-align: center;
	line-height: 60px;
	border-radius: 30px;
	background: #fff;
	color: #888;
}
p.yunsuan{
	display: block;
	width: 60px;
	height: 60px;
	float: left;
	margin-left: 10px;
	font-size: 30px;
	font-weight: 700;
	margin-top: 15px;
	text-align: center;
	line-height: 60px;
	border-radius: 30px;
	background: #fff;
	color: #888;
	background: #FFF0F5;
}
#chu{
	position: absolute;
	left: 230px;
	top: 325px;
}
p:hover{
	background: #9C89F6;
	color: #fff;
}
.dengyu{
	display: block;
	width: 60px;
	height: 60px;
	border: none;
	list-style: none;
	border-radius: 30px;
	font-size: 30px;
	background: #F1FF92;
	position: absolute;
	top: 340px;
	left: 170px;
}
span.clear{
	background: #FF9FA8;
	color: #FFF;
}
.dengyu:hover{
	background: #ABB850;
	color: #fff;
}
span.clear:hover{
	background: #F68991;
	color: #fff;
}
span:hover{
	background: #9C89F6;
	color: #fff;
}
.num1,.num2,.fuhao{
	display: block;
	width: 180px;
	height: 50px;
	background: #7BA7BB;
	position: absolute;
	top: 40px;
	left: 100px;
	text-align: right;
	padding-right: 10px;
	line-height: 50px;
	font-size: 30px;
	font-weight: 700;
	display:block;
}
</style>
<script src="jquery-1.7.2.min.js"></script>
<script src="jisuanqi.js" type="text/javascript" charset="utf-8"></script>
<body>
	<h1>我的计算器</h1>
	<form action="" method="post">
		<a href="javascript:void(0)"><span class="clear">C</span></a>
		<input type="text" class="num1" name="num1"/>
		<input type="text" class="fuhao" name="fuhao"/>
		<input type="text" class="num2" name="num2" value="<?php echo $zuihou;?>"/>
		<br /><br /><br /><br />
		<div>
			<a href="javascript:void(0)"><span class="num">7</span></a>
			<a href="javascript:void(0)"><span class="num">8</span></a>
			<a href="javascript:void(0)"><span class="num">9</span></a>
			<a href="javascript:void(0)"><p class="yunsuan" id="jia">+</p></a>
			<a href="javascript:void(0)"><span class="num">4</span></a>
			<a href="javascript:void(0)"></aa><span class="num">5</span></a>
			<a href="javascript:void(0)"><span class="num">6</span></a>
			<a href="javascript:void(0)"><p class="yunsuan" id="jian">-</p></a>
			<a href="javascript:void(0)"><span class="num">1</span></a>
			<a href="javascript:void(0)"><span class="num">2</span></a>
			<a href="javascript:void(0)"><span class="num">3</span></a>
			<a href="javascript:void(0)"><p class="yunsuan" id="cheng">*</p></a>
			<a href="javascript:void(0)"><span class="num">0</span></a>
			<a href="javascript:void(0)"><span class="num">.</span></a>
			<a href="javascript:void(0)"><input type="submit" class="dengyu" value="="></a>
			<a href="javascript:void(0)"><p class="yunsuan" id="chu">/</p></a>
		</div>
	</form>
</body>
</html>
 
 
 
 

